* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3498db;
    --primary-dark: #2980b9;
    --secondary-color: #e74c3c;
    --secondary-dark: #c0392b;
    --success-color: #2ecc71;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --cell-color: #d6e9f7;
    --gray-color: #95a5a6;
    --dark-gray: #34495e;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Microsoft YaHei', sans-serif;
    background-color: #f5f5f5;
    background-image: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--dark-color);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px 0;
}

.container {
    max-width: 850px;
    margin: 20px auto;
    padding: 25px;
    background-color: #fff;
    border-radius: 15px;
    box-shadow: var(--shadow);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.title {
    font-size: 2.8rem;
    margin-bottom: 25px;
    color: var(--dark-color);
    position: relative;
    display: inline-block;
}

.title::after {
    content: "";
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 3px;
}

.game-info {
    margin-bottom: 25px;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border-left: 5px solid var(--primary-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    font-size: 1.1rem;
    transition: var(--transition);
}

.game-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.difficulty-selector {
    margin-bottom: 25px;
}

.difficulty-selector p {
    font-size: 1.1rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.difficulty-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 12px;
}

.difficulty-btn {
    background-color: var(--gray-color);
    padding: 10px 20px;
    font-weight: normal;
    transition: var(--transition);
    min-width: 100px;
    position: relative;
    overflow: hidden;
}

.difficulty-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.4s ease;
}

.difficulty-btn:hover::before {
    left: 100%;
}

.difficulty-btn.active {
    background-color: var(--success-color);
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(46, 204, 113, 0.3);
    transform: translateY(-2px);
}

.game-controls {
    margin-bottom: 25px;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    margin: 0 8px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: var(--transition);
    box-shadow: 0 4px 6px rgba(52, 152, 219, 0.3);
    position: relative;
    overflow: hidden;
}

button::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.4s ease;
}

button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 6px 10px rgba(52, 152, 219, 0.4);
}

button:hover::before {
    left: 100%;
}

button:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(52, 152, 219, 0.4);
}

#reset-button {
    background-color: var(--secondary-color);
    box-shadow: 0 4px 6px rgba(231, 76, 60, 0.3);
}

#reset-button:hover {
    background-color: var(--secondary-dark);
    box-shadow: 0 6px 10px rgba(231, 76, 60, 0.4);
}

.game-grid {
    display: flex;
    flex-direction: column;
    margin: 0 auto 25px;
    max-width: 650px;
    position: relative;
    align-items: center;
    padding: 20px 0;
    background-color: rgba(214, 233, 247, 0.2);
    border-radius: 15px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 六边形网格布局 */
.hex-row {
    display: flex;
    margin-top: -12px; /* 减小行间重叠 */
}

.hex-row:first-child {
    margin-top: 0;
}

.hex-row:nth-child(even) {
    margin-left: 20px; /* 减小偶数行偏移 */
}

.cell {
    width: 40px;   /* 减小单元格尺寸 */
    height: 46px;  /* 减小单元格尺寸 */
    margin: 0 1px; /* 减小间距 */
    position: relative;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem; /* 减小字体 */
    transition: all 0.3s ease;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background-color: var(--cell-color);
    z-index: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cell::after {
    content: "";
    position: absolute;
    top: 1px;
    left: 1px;
    right: 1px;
    bottom: 1px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background-color: #e6f2fc;
    opacity: 0.3;
    z-index: -1;
}

.cell:hover {
    background-color: #b8dcf5;
    transform: scale(1.05);
    z-index: 2;
}

.cell.barrier {
    background-color: var(--dark-gray);
    cursor: not-allowed;
    transform: scale(1);
    box-shadow: 0 0 8px rgba(52, 73, 94, 0.6);
}

.cell.barrier::after {
    background-color: black;
    opacity: 0.1;
}

.cell.thief {
    background-color: var(--secondary-color);
    color: white;
    transition: all 0.3s ease-in-out;
    animation: thiefPulse 1.2s infinite alternate;
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.7);
    z-index: 3;
}

@keyframes thiefPulse {
    from {
        transform: scale(1);
        box-shadow: 0 0 5px rgba(231, 76, 60, 0.5);
    }
    to {
        transform: scale(1.1);
        box-shadow: 0 0 15px rgba(231, 76, 60, 0.8);
    }
}

.cell.edge {
    background-color: var(--success-color);
    opacity: 0.7;
    border: none;
    box-shadow: 0 0 5px rgba(46, 204, 113, 0.5);
}

.cell.edge:hover {
    opacity: 0.9;
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.7);
}

.instructions {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-top: 25px;
    text-align: left;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.instructions::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary-color), var(--success-color));
}

.instructions p {
    margin: 8px 0;
    padding-left: 10px;
    position: relative;
}

.instructions p strong {
    color: var(--primary-dark);
    font-weight: 700;
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 10;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.modal.active {
    display: flex;
    animation: modalFadeIn 0.4s forwards;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-content {
    background-color: #fff;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateY(0);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.modal-content::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

#result-title {
    font-size: 2.5rem;
    margin-bottom: 20px;
    font-weight: 700;
}

#result-title.win {
    color: var(--success-color);
}

#result-title.lose {
    color: var(--secondary-color);
}

#result-message {
    font-size: 1.2rem;
    margin-bottom: 25px;
}

#play-again {
    background-color: var(--primary-color);
    margin-top: 20px;
    min-width: 180px;
}

/* 移动动画 */
.cell.moving {
    opacity: 0.7;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

.cell.just-moved {
    animation: highlight 0.6s ease-in-out;
    z-index: 5;
}

@keyframes highlight {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(231, 76, 60, 0);
    }
    50% {
        transform: scale(1.3);
        box-shadow: 0 0 20px rgba(231, 76, 60, 1);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(231, 76, 60, 0);
    }
}

/* 响应式设计 */
@media (max-width: 600px) {
    .container {
        padding: 15px;
        margin: 10px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .cell {
        width: 32px;
        height: 37px;
        font-size: 0.8rem;
    }
    
    .difficulty-buttons {
        flex-wrap: wrap;
    }
    
    button {
        padding: 10px 20px;
        font-size: 0.95rem;
    }
    
    .modal-content {
        padding: 30px 20px;
    }
    
    #result-title {
        font-size: 2rem;
    }
}

/* 页脚 */
.footer {
    text-align: center;
    margin-top: 30px;
    padding: 10px;
    font-size: 0.9rem;
    color: #95a5a6;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s;
}

.footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
} 